package com.controller;


import com.dao.MovieDao;
import com.entity.Movie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
public class movieController {
    @Autowired
    private MovieDao movieDao;

    @RequestMapping("/getMovieList")
    @CrossOrigin
    public List<Movie> getMovieList()
    {
        List<Movie> list1=movieDao.getMovieList();
        return list1;
    }

    @RequestMapping("/getMovieById")
    @CrossOrigin
    public Movie getMovieById(@RequestParam String id)
    {
        Movie movie = movieDao.getMovieById(id);
        return movie;
    }
}
